<%@ page language="java"  pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/commons/indexheader.jsp"%>
<style>
.Login {
    background: url("http://p1.51mdq.com/images/LoginspBg1.gif") no-repeat scroll left top transparent;
    height: 320px;
    margin: 113px auto 0;
    padding-top: 118px;
    width: 498px;
}
</style>
</head>
<body style="background:#545e68 url(images/LoginBig.gif) top left repeat-x; margin:0 auto;">
<div class="Login"> 
<form   method="post" action="${ctx}/Users/loginCheck.action" id="f1">
				<div class="Enter">
					<div class="Username">
						<input type="text" name="userName" id="userName" />
					</div>
					<div class="Username">
						<input type="password" name="password" id="password" />
					</div>
				</div>
				<div class="LogIcon">
					<a href="javascript:;" onclick="checklogin()"><img
							src="http://p1.51mdq.com/images/LogIcon.gif" />
					</a>
				</div> 	 
 
</form> 
</div> 
 <script type="text/javascript">
			function checklogin(){
				if(validate()){
		        	submit();
		        }
			}	
			
			document.onkeydown=function(event){
				e = event ? event :(window.event ? window.event : null); 
		        if(e.keyCode==13){
		        	if(validate()){
		        		submit();
		        	}
		        }
		    }
		    
		    function validate(){
		    	var name=$('#userName').val();
		    	var password=$('#password').val();
		    		if(name==""){
		    			alert("登录名不能为空");
		    			$("#name").focus();
		    			return false;
		    		}
		    		
		    		if(password==""){
		    			alert("密码不能为空");
		    			$("#password").focus();
		    			return false;
		    		}
		    		
		    		return true	;
		    }
		    
		    function submit(){
		    	var f1 = document.getElementById("f1");
		    	f1.action="${ctx}/Users/loginCheck.action";
		    	f1.submit();
		    }

		</script>
</body>
</html>
